<template>
    <div style="height:100%" v-loading="loading">
        <v-tableTitle :btnConfig="btnConfig" :title="$t('wave.waveprint')"></v-tableTitle>
        <ag-grid class="base-grid" ref="instockTicketEditTableRef" :hasCheck="true" :hasIndex="false" :hasEdit="true"
            v-model="gridObj" :defaultColDef="defaultColDef" :highlightCurrentRow="false" :disabled="true"
            :data="rowData" :rules="rules" :height="height" :tmsShowFilter="true" :columnConfig="columnConfig" :extraColumns="extraColumns" :showSummary="false" :pagination="true"
            :tableSettingVisible.sync="showTableSetting" :page="page" :pageSize="pageSize" :total="total"
            @selection-change="handleSelectionChange" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" @setdialog="setdialog" @filter-changed="filterChanged"
            @cell-dblclick="cellDblclick" @grid-ready="agGridReady">
        </ag-grid>
    </div>
</template>

<script>
import { getWaveDocPrintEntryList, printTheCourierNote, printInvoice } from "@/api/business/wave"
import baseMixin from "@/mixins/BaseMixin";
import agGridBaseMixin from "@/mixins/AgGridBaseMixin";

export default {
    name: "waveDocPrint",
    mixins: [baseMixin, agGridBaseMixin],
    data() {
        return {
            height: 0,
            columnConfig:{ menu_id: 17, menu_code:"ASN", menu_list_code:"1701"},
            defaultColDef: {
                editable: true,
                flex: 1,
                resizable: true,
            }
        }
    },
    mounted() {
        this.height = this.getHeight(window);
        // 波次列表
        this.getTableData(1, {});
        // 打印快递单 波次编号(waveNumber)
        this.printTheCourierNote('0000002398');
        this.printInvoice('0000002398');
    },
    methods: {
      agGridReady(params) {
        this.gridObj = params.api;
      },
      setdialog() {
        console.log("open edit page");
      },
      getTableData(page, data) {
        getWaveDocPrintEntryList(page, data).then(res => {
        });
      },
      printTheCourierNote(waveNumber) {
        // 打印快递单
        printTheCourierNote(waveNumber).then(res => {
          console.log(res)
        })
      },
      printInvoice(waveNumber) {
        // 打印发货单
        printInvoice(waveNumber).then(res => {
          console.log(res)
        })
      }
    }
}
</script>

<style>
</style>
